<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
	<title th:text="${session.title}">123</title>
	<link th:replace="common/header"/>
	<link rel="stylesheet" th:href="@{/css/ace-skins.min.css}" />
	</head>
	<body class="navbar-fixed">
  	<div th:replace="common/top"></div>
		<div class="container-fluid main_bg" id="main-container">
			<a id="menu-toggler" href="#"><span></span></a>
			<div th:replace="common/menu"></div>
			<div id="main-content" class="clearfix">
				<div id="page-content" class="clearfix">
					<div th:replace="common/title"></div>
						<h3 class="header smaller lighter blue"><em class="icon-eye-open"></em>我要置换球员</h3>
						<div th:if="${session.footUser.qx.text == '会员' || session.footUser.qx.text == 'VIP1' || session.footUser.qx.text == 'VIP2' || session.footUser.qx.text == 'VIP3'}">
                        <h3 class="header smaller lighter blue"><em class="icon-list"></em>球队球员</h3>
                        <div th:if="${null == qyList}" th:text="'没有找到' + ${session.footUser.nike} + '的球员'">123</div>
                            <form class="form-horizontal" th:object="${footClubSearchForm}" method="post" th:action="@{/hy/footClub/changePerson}" id="form" name="form" th:if="${null != qyList}">
                            <div class="row-fluid">
                                <div class="span12">
                                    <table id="table_bug_report" class="table table-hover">
                                    <thead>
                                        <tr>
                                            <th class="center" style="width:60px;"><label>选择</label></th>
                                            <th style="width:40px;">位置</th>
                                            <th>球员名称</th>
                                            <th style="width:80px;">等级</th>
                                            <th class="hidden-480" style="width:110px;">国籍</th>
                                            <th class="hidden-480" style="width:254px;">所属俱乐部</th>
                                            <th class="hidden-480" style="width:40px;">年龄</th>
                                            <th class="hidden-480" style="width:40px;">评分</th>
                                            <th class="hidden-480" style="width:60px;">球员身价</th>
                                            <th class="hidden-480">球员状态</th>
                                            <th class="hidden-480">剩余场次</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr th:each="t:${qyList}">
                                            <td class="center"><label><input type="checkbox" name="selectIds" th:value="${t.id + ':' + t.xycs}"/><span class="lbl">&nbsp;</span></label></td>
                                            <td th:replace="common/footer"></td>
                                            <td class="hidden-480" th:text="${t.ssjlb}">123</td>
                                            <td class="hidden-480" th:text="${t.nl}">123</td>
                                            <td class="hidden-480" th:text="${t.pf}">123</td>
                                            <td class="hidden-480" th:text="${#numbers.formatDecimal(t.qysj, 3, 'POINT', 2)}">123</td>
                                            <td class="hidden-480">
                                                <img alt="" th:src="@{/images/foot/xy.png}" src="" style="height:20px;" th:if="${t.xycs < 10}"/>
                                                <img alt="" th:src="@{/images/foot/gp.png}" src="" style="height:20px;" th:if="${t.gpzt == 1}"/>
                                            </td>
                                            <td class="hidden-480" th:text="${t.xycs}">123</td>
                                        </tr>
                                    </tbody>
                                </table>
                                </div>
                            </div>
                            <div class="row-fluid">
                                <div class="text-center span12">
                                    <button class="btn" type="button" id="change" onclick="changePerson();"><em class="icon-arrow-left"></em>确认置换</button>
                                    <a class="btn" type="button" th:href="@{/index}"><em class="icon-arrow-left"></em>返回首页</a>
                                </div>
                            </div>
                            </form>
						</div>
              		<!--/#page-content-->
				</div>
				<div th:replace="common/skin :: skin"></div>
		</div><!--/#main-content-->
	</div><!--/.fluid-container#main-container-->
	<div th:replace="common/js"></div>
	<script type="text/javascript">
		function changePerson(){
			var chk = 0;
			var chkObjs = document.getElementsByName("selectIds");
			for(var i=0;i<chkObjs.length;i++){ 
				if(chkObjs[i].checked){ 
					chk += 1; 
				} 
			} 
            if(chk !== 5){
           	 	showTip('tip','选择5个任意球员才能兑换新球员',4000);
           	 	return false;
            }else{
            	$("#change").attr("disabled","disabled");
            	$.ajax({
    				type: "POST",
    				dataType: "text",
    				url: "/hy/footClub/changePerson",
    				data:$("#form").serialize(),
    				success: function(data){
    					if(data){
    						showTip('tip','获得新球员' + data, 4000);
    					}else{
    						showTip('tip','数据异常,请联系管理员', 4000);
    					}
    					window.setTimeout("refreshPage()",4000);
    				}
    			});
            }
		}

		function refreshPage(){ 
			window.location.href="/hy/footClub/openChangePage";
		} 
	</script>
	</body>
</html>
